var pathFinding = require('./');
var path = require('path');

var pf = new pathFinding.pathFinding();
let ret = [];

// pf.initMapByLengthAndWidth(5, 5);
// const mapLength = pf.mapLength();
// const mapWidth = pf.mapWidth();
// pf.setMapBlock(mapLength / 2, mapWidth / 2, 1);
// console.log('mapLength', mapLength, '   mapWidth', mapWidth);
// ret = pf.astar(0, 0, mapLength - 1, mapWidth - 1);
// console.log('astar', JSON.stringify(ret));
// ret = pf.jps(0, 0, mapLength - 1, mapWidth - 1);
// console.log('jps', JSON.stringify(ret));

let pathFile = path.join(__dirname, 'path');
console.log('file path', pathFile);
pf.initMapByFile(pathFile);
const mapLength = pf.mapLength();
const mapWidth = pf.mapWidth();
console.log('mapLength', mapLength, '   mapWidth', mapWidth);
ret = pf.astar(0, 0, 7, 9);
console.log('astar', JSON.stringify(ret));
ret = pf.jps(0, 0, 7, 9);
console.log('jps', JSON.stringify(ret));